package com.xiaoye.qbproject.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoye.qbproject.domain.QbWarfare;
import com.xiaoye.qbproject.service.QbWarfareService;
import com.xiaoye.qbproject.mapper.QbWarfareMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author Administrator
* @description 针对表【QB_WARFARE(战争)】的数据库操作Service实现
* @createDate 2024-12-30 14:46:38
*/
@Service
public class QbWarfareServiceImpl extends ServiceImpl<QbWarfareMapper, QbWarfare>
    implements QbWarfareService{

    @Override
    public List<String> getAllWarfareName() {
        List<QbWarfare> qbWarfares = baseMapper.selectList(Wrappers.<QbWarfare>lambdaQuery().select(QbWarfare::getName));
        if (qbWarfares != null && !qbWarfares.isEmpty()) {
            return qbWarfares.stream().map(QbWarfare::getName).collect(Collectors.toList());
        }
        return null;
    }

    @Override
    public List<QbWarfare> selectListWithAreaName(QbWarfare qbWarfare) {
        return baseMapper.selectListWithAreaName(qbWarfare);
    }
}




